package org.fall.mvc.handler;

import com.atguigu.crowd.entity.Admin;
import org.fall.service.api.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class TestHandler {

    @Autowired
    private AdminService adminService;


    @RequestMapping("send/array.html")
    @ResponseBody
    public String testReceiveArrayOne(@RequestParam("array[]") List<Integer> array){

        for (Integer integer : array) {
            System.out.println(integer);
        }

        return "success";
    }

    @RequestMapping("/test/ssm.html")
    public String testSSM(Model model){

//        System.out.println(new BCryptPasswordEncoder().encode("123123"));

        List<Admin> adminList = adminService.getAll();

        model.addAttribute("adminList",adminList);
        return "target";
    }

}
